package work20241207_chap8.l;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;

/**
 * @author zdl
 * @date 2024/12/7
 */
public class GreenStick implements MagicStick {
    @Override
    public int fire() {
        LocalDate currentDate = LocalDate.now();
        // 使用 DateTimeFormatter 格式化日期
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM");
        String currentMonth = currentDate.format(formatter);

        if (Integer.parseInt(currentMonth) == 6 || Integer.parseInt(currentMonth) == 7 || Integer.parseInt(currentMonth) == 8) {
            return 2;
        }
        return 1;
    }
}
